All Questions
Tagged with swiftobject-oriented
23 questions
4votes
2answers
175views
Swift String-extension 'countOccurrencesOfChar'
Loosely inspired by Ruby's String.count-method I wrote a similar Swift-method myself as an extension to the String-class. Then I had the idea to use a second parameter with which you can control if ...
1vote
1answer
63views
"Pick up" images when tapped on and keep track of it
Trying to get my first job as a developer I made an app I was extremely proud of: https://github.com/AnatolyRudenko/Crystals.Dragons The game starts in a random room of a random maze. Some prebuilt ...
1vote
2answers
254views
Trying (and failing) to implement the best conventions on OOP Swift
I'm making a MacOS app that will do some analysis on the user's calendar data. For now it only supports Apple's native calendar (EventKit), but I will later add ...
1vote
1answer
152views
Simple State Machine and Transition Table
The goal is to have well defined state transitions, and the ability to provide the next event to execute. I'd like to know if this is a proper implementation of State Machine, considering how states ...
1vote
1answer
105views
Initializing more than one instance object at a time in init method
I have a RadioStation class file and a view controller where I create two station objects based on this class, one for FM and one for AM. I created both of these ...
3votes
1answer
84views
Handle HTTP and BLE requests
Im implementing and designing a workflow that performs both HTTP and BLE requests. Im having trouble figuring out the best approach to design a service to handle both types of requests, and manage ...
3votes
2answers
463views
Implement The Singleton Pattern for Persistency managers Swift [closed]
I am creating an iOS app and I want to implement Singleton Pattern. I have created "Singleton" LibraryAPI to act as an entry point UserManager object to get data from web API. after that I used a ...
2votes
2answers
1kviews
Formatting a price in Swift using an extension vs. a class
I have a price as a Double, which I should format it as a String. Should I use an extension instead of classical class to ...
0votes
2answers
569views
Design a system for creating a coffeeshop menu
During an interview I was asked to design the menu for a coffee shop employee so that the employee would go and add different items to the menu. This is the design that I came up with. I just want ...
3votes
1answer
340views
Dividing an arbitrary dollar amount into the fewest bills and coins
I am taking a class in mobile application development this fall. I have finished my first assignment of creating a class to divide an arbitrary dollar amount into the minimum number of bills and coins....
2votes
1answer
96views
Classes for representing teleconferencing numbers
I'm developing an app that joins tele-conference calls so we use conference numbers a lot. I've got this basic structure to encapsulate the information regarding a conference number. ...
1vote
0answers
3kviews
Swift/iOS component for label with clickable text buttons
So I'm creating a component based on UILabel, which I'm calling RichLabel. The main goal is to add support for clickable links (...
1vote
1answer
2kviews
Swift/iOS: Subclassing UILabel and setting properties
I'm writing this subclass to add an icon to a UILabel. It works, but I'm wondering if this is the best/cleanest way to do it. Do you see any improvements? Should maybe ...
2votes
1answer
208views
Extension vs Class For ViewModel
What the advantages & disadvantages to each of these approaches pertaining to creating file that takes care of the view configuration to reduce a controller's file size. Main Purposes Are: Memory ...
3votes
1answer
196views
Swift Attempt To Reduce Massive View Controller
In an effort to reduce the size of a View Controller class I am wondering if this structure is an acceptable, safe way to modify the UI on a Controller Class. The only thing that I see "wrong" with ...